<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script> -->
    <!-- <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all" /> -->
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" />
    <link href="css/chromagallery.css" rel="stylesheet" type="text/css" media="all" />
    <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
    <link href="css/owner.css" rel="stylesheet" type="text/css" media="all" />
    <title>个人中心</title>
</head>

<body>
    <?php 
    require_once("./system/loginCheck.php");
    require_once("../congfig/config.php");
    $uid=$_SESSION['loginflag'];
    $username=$_SESSION['username'];
     ?>
    <div class="navbar-wrapper">
        <div class="container">
            <nav class="navbar navbar-inverse navbar-static-top cl-effect-21">
                <div class="container">
                    <div id="navbar" class="navbar-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="../index.php">首页</a></li>
                            <li><a href="../project-center.php">项目中心</a></li>
                            <li><a href="../project-teacher.php">指导教师</a></li>
                            <li><a href="#About Us">关于我们</a></li>
                            <li><a href="#" style="font-size:13px;margin-left: 100px;">个人中心</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
        </div>
        <div class="templatemo-flex-row">
                <div class="templatemo-sidebar">
                    <nav class="templatemo-left-nav">
                        <ul>
                             <h4 id="uname"><?php echo $username; ?></h4>
                            <li><a href="owner-myProject.php"><i class="fa fa-bars fa-fw"></i>我的项目</a> </li>
                            <li><a href="owner-clareProject.php" class="active"><i class="fa fa-fire fa-fw"></i>发布项目</a></li>
                            <li><a href="owner-editInfor.php"><i class=" fa fa-user fa-fw"></i>修改信息</a></li>
                            <li><a href="owner-changePass.php"><i class="fa fa-cog fa-fw"></i>修改密码</a></li>
                            <li><a href="../loginout.php"><i class="fa fa-map-marker fa-fw"></i>注销</a></li>
                        </ul>
                    </nav>
                </div>
                <div class="templatemo-content col-1 light-gray-bg" style="height:1000px;">
                    <div class="container" id="msg">
                        <div class="tab-pane" role="tabpanel">
                            <div style="text-align: right;width: 100%;">
                                <form action="doowner-clareProject.php" enctype="multipart/form-data" method="post" class="form-horizontal">
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">项目名称</label>
                                        <div class="col-xs-8">
                                            <input type="text" id="pName" name="pName" class="form-control input-sm" style="margin-top: 7px;">
                                        </div><span id="pName_result"></span>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">项目负责人</label>
                                        <div class="col-xs-8">
                                            <input type="text" value="<?php echo $username ?>" id="pChar" name="pChar" class="form-control input-sm" style="margin-top: 7px;">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">指导教师</label>
                                        <div class="col-xs-8">
                                            <input type="text" id="teacher" name="teacher" class="form-control input-sm" style="margin-top: 7px;">
                                        </div><span id="pChar_result"></span>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">项目简介</label>
                                        <div class="col-xs-8">
                                            <textarea type="text" id="pDesc" name="pDesc" class="form-control input-sm" style="margin-top: 7px;height: 300px;"></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">文件上传</label>
                                        <div class="col-xs-8">
                                            <input type="file" name="Enclosure" id="Enclosure" style="margin-top: 7px;" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-2 control-label">项目进度</label>
                                        <div class="col-xs-8">
                                            <input type="hidden" value="0" id="pRank" name="pRank">
                                            <input type="text"  readonly="true" class="form-control input-sm" value="立项申请" style="margin-top: 7px;">
                                            
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-xs-offset-4 col-xs-5" style="margin-left: 100px;">
                                            <input type="submit" id="addProject-bc" class="btn btn-xs btn-success" style="margin-top: 7px;"
                                                value="发布">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php 
               if (isset($_GET["text"])) {
                  $text=$_GET["text"];
                  echo "<script>alert('$text')</script>";
               } ?>
             <!-- 底部兰 -->
       <!--  <section class="footer" id="About Us" style="margin-top:200px;width: 100%;">
                <h2 class="text-center">THANKS FOR VISITING US</h2>
                <hr>
                <div class="container">
                    <div class="row">
                        <div class="col-md-4  col-md-offset-4">
                            <div class="contact-info">
                                <div class="phone">
                                    <i class="glyphicon glyphicon-phone-alt"></i>
                                    <p class="p4">+00 1010101010</p>
                                </div>
                                <div class="email-info">
                                    <i class="glyphicon glyphicon-envelope"></i>
                                    <p class="p4">469902XXX@qq.com </p>
                                </div>
                            </div>
                        </div> 
                    </div> 
                </div> 
                <hr>
                <div class="copyright">
                    <p>Copyright &copy; 2018.徐志摩 </p>
                </div>
            </section> -->
            <!-- 底部兰 end-->
    </div>
</body>

</html>
<script type="text/javascript">
        window.onload = function(){

            var pName = document.querySelector("#pName");
            console.log("onload");

            pName.onblur = function(){
                var pNameValue = pName.value;
                console.log("onblur");
                var xhr = null;
                if(window.XMLHttpRequest) {
                    xhr = new XMLHttpRequest();
                } else {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xhr.open("get","./judge_pName.php?pName=" + pNameValue,true);
                console.log(pNameValue);
                xhr.send();
                xhr.onreadystatechange = function(){
                    if(xhr.readyState == 4) {
                        if(xhr.status == 200) {
                            var result = xhr.responseText;
                            console.log(result);

                            var newresult=result.charAt(result.length-1);
                            console.log(newresult);
                            var pName_result = document.querySelector("#pName_result");
                            if(newresult == "0") {
                                pName_result.innerText = "OK";
                            } else if(newresult=="1") {
                                pName_result.innerText = "项目名已经被注册";
                            }
                            else if(newresult=="2"){
                                pName_result.innerText = "项目名不可为空";
                            }

                            else{
                                pName_result.innerText = "hehe ";
                            }
                        }
                    }
                };

            };


            var pChar = document.querySelector("#teacher");
            pChar.onblur = function(){
                var pCharValue = pChar.value;
                console.log("onblur");
                var xhr = null;
                if(window.XMLHttpRequest) {
                    xhr = new XMLHttpRequest();
                } else {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xhr.open("get","./judge_pChar.php?pChar=" + pCharValue,true);
                console.log(pCharValue);
                xhr.send();
                xhr.onreadystatechange = function(){
                    if(xhr.readyState == 4) {
                        if(xhr.status == 200) {
                            var result = xhr.responseText;
                            console.log(result);

                            var newresult=result.charAt(result.length-1);
                            console.log(newresult);
                            var pChar_result = document.querySelector("#pChar_result");
                            if(newresult == "0") {
                                pChar_result.innerText = "查无此人请确认是否已经注册";
                            } else if(newresult=="1") {
                                pChar_result.innerText = "OK";
                            }
                            else if(newresult=="2"){
                                pChar_result.innerText = "教师不可为空";
                            }

                            else{
                                pChar_result.innerText = "hehe ";
                            }
                        }
                    }
                };

            };
        }
    </script>